<template>
  <div>
    <el-dialog
      :model-value="open"
      :close-on-click-modal="false"
      :title="title"
      width="800px"
      append-to-body
      :before-close="handleClose"
    >
      <el-form
        ref="editForm"
        :model="form"
        label-width="120px"
        :label-position="labelPosition"
      >
        <el-form-item label="需求标题" prop="tag">
          <el-input v-model="form.tag" size="small"></el-input>
        </el-form-item>
        <el-form-item label="需求描述" prop="describes">
          <el-input v-model="form.describes" type="textarea" :control="false"></el-input>
        </el-form-item>
        <el-form-item label="需求类型" prop="demandType">
          <el-select
            v-model="form.demandType"
            clearable
          >
            <el-option
              v-for="dict in dicts[DictDirection.需求类型]"
              :key="dict.dictValue"
              :value="dict.dictValue"
              :label=" dict.dictLabel"
            >
              {{
                dict.dictLabel
              }}
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="功能修改位置" prop="position">
          <el-input v-model="form.position" size="small"></el-input>
        </el-form-item>
        <el-form-item label="期望完成时间" prop="submissionTime">
          <el-date-picker
            v-model="form.submissionTime"
            value-format="yyyy-MM-dd"
            size="small"
            type="date"
            placeholder="请选择日期"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="紧急程度" prop="businessType">
          <el-radio-group v-model="form.businessType">
            <el-radio v-for="dict in dicts[DictDirection.紧急程度]" :key="dict.dictValue" :label="dict.dictValue">{{ dict.dictLabel }}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="测试人员" prop="tester">
          <el-input
            v-model="form.tester"
            filterable
            placeholder="请选择测试人员"
            size="small"
          >
          </el-input>
        </el-form-item>
        <el-form-item label="验收人" prop="acceptancePerson">
          <el-input
            v-model="form.acceptancePerson"
            filterable
            placeholder="请选择验收人"
            size="small"
          >
          </el-input>
        </el-form-item>
        <el-form-item label="操作人" prop="demanders">
          <el-input v-model="form.demanders" size="small" disabled></el-input>
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" :control="false"></el-input>
        </el-form-item>
        <!-- <el-form-item label="图片文件上传" prop="files" class="uploadBox">
          <ActivitiUpload v-model="form.fileImgeList" v-model:del-file-list="form.delFileList" />
        </el-form-item> -->
      </el-form>
    </el-dialog>
  </div>
</template>
<script lang="ts" setup>
import { ref, defineEmits, defineProps } from 'vue'
import useDicts, { DictDirection } from '@/store/modules/dicts'
import { issuedQueryList } from '@/api/demandManagement'

const dicts = useDicts()
dicts.setDicts(DictDirection.紧急程度)
const props = defineProps({
  open: {
    type: Boolean,
  },
  title: {
    type: String,
  },
})
const emit = defineEmits(['update:open'])
const labelPosition = ref('right')
// 表单参数
const form = ref({
  tag: '',
  describes: '',
  demanders: '',
  submissionTime: '',
  businessType: '',
  remarks: '',
  position: '',
  demandType: '',
  acceptancePerson: '',
  tester: '',
})
const handleClose = () => {
  emit('update:open', false)
}
const getList = (id) => {
  issuedQueryList(id).then(res => {
    if (res.code == 200) {
      form.value = res.data[0]
    }
  })
}
defineExpose({
  getList,
})
</script>
